#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 10;
ll a[N],sum;
int main()
{
	ll t;
	cin >> t;
	while (t--)
	{
		ll n;
		cin >> n;
		sum = 0;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			sum += a[i];
		}
		int f = 0;
		for (int i = 1; i <= n; i++)
		{
			if ((sum - a[i]) == a[i] * (n - 1))
			{
				f = 1;
				break;
			}
		}
		if (f) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}